package com.dingreading.cloud.admin.dto;

import com.alibaba.fastjson.JSONArray;
import com.dingreading.cloud.admin.entity.SubjectLessonVideo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mybatisflex.annotation.RelationOneToMany;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Data
public class SubjectLessonDto implements Serializable {

    /**
     * 主键ID
     */
    private Long id;

    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date addTime;

    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date editTime;

    private String addStaffUid;

    private String addStaffName;

    private String lastStaffUid;

    private String lastStaffName;

    private String uid;

    /**
     * 主学科id
     */
    private Long subjectMainId;

    /**
     * 关联学科的id
     */
    private Long subjectId;

    /**
     * 关联学科的学科名
     */
    private String subjectMainName;

    /**
     * 课次名
     */
    private String lessonName;

    /**
     * 教学目的
     */
    private String teachAims;

    /**
     * 课次序号
     */
    private Integer lessonOrder;

    /**
     * 权限 0.无 1.有
     */
    private Long power;

    /**
     * 状态 0.禁用 1.启用
     */
    private Integer enabled;

    /**
     * 教案地址
     */
    private String teachPlanUrl;

    /**
     * 课件html地址
     */
    private String htmlUrl;

    /**
     * 资料地址
     */
    private String dataUrl;

    /**
     * 下载次数
     */
    private Integer downloadNum;

    /**
     * 资料下载 0.无 大于0.有
     */
    private Boolean downloadStatus;

    /**
     * 兜学慧课件id
     */
    private Long dxhLessonId;
    /**
     * 兜学慧教学视频
     */
    private JSONArray teachVideoList;
    /**
     * 兜学慧说课视频
     */
    private JSONArray speakVideoList;

    /**
     * 书籍信息
     */
    private String bookIsbn;
    private String bookImg;
    private String bookPress;
    private String bookImgCdnUrl;

    /**
     * 视频集合
     */
    @RelationOneToMany(selfField = "uid", targetField = "lessonUid")
    private List<SubjectLessonVideo> videoList;

    /**
     * 教学视频是否上传
     */
    private Boolean teachVideoStatus = false;
    /**
     * 说课视频是否上传
     */
    private Boolean speakVideoStatus = false;

    private String subjectNodes;

    @RelationOneToMany(
            selfField = "subjectNodes",
            selfValueSplitBy = ",", //使用 "," 对 diseaseIds 的值进行分割
            targetTable = "subjects", //只获取某个字段值需要填入目标表名
            targetField = "id", //测试目标字段是字符串类型是否正常转换
            valueField = "subjectName" //测试只获取某个字段值是否正常
    )
    private List<String> subjectList;

}
